<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<html>  
<head>  
  <title></title>  
</head>  
<body>  

<div id="dy">
jyfh2121212121
</div>
<input type="button" value="打    印" onclick="return PrintTable(dy)">
 

<script type="text/javascript">  
function PrintTable(Id){
    var mStr;
    mStr = window.document.body.innerHTML ;
    var mWindow = window;               
    window.document.body.innerHTML =Id.innerHTML;
    mWindow.print();
    window.document.body.innerHTML = mStr;
}

</script>  
</body>  
</html>  